{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d931ac4a",
   "metadata": {},
   "source": [
    "## 本周学习内容"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7621995b",
   "metadata": {},
   "source": [
    "### 1.[github education packages](https://education.github.com/pack)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "777764c8",
   "metadata": {},
   "source": [
    "* 注册学生账号，获取pycharm的激活邮箱，为后续使用pycharm做准备"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "310a4a9d",
   "metadata": {},
   "source": [
    "### 2.[pycharm下载](https://www.jetbrains.com/pycharm/)安装和 jupyter notebook的安装学习"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "643d035c",
   "metadata": {},
   "source": [
    "* 注意事项：pycharm需下载专业版"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d258361b",
   "metadata": {},
   "source": [
    "### 3.jupyter notebook的学习使用"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "265c0642",
   "metadata": {},
   "source": [
    "* 可在[官网](https://jupyter.org/)上尝试体验，及了解jupyter的具体介绍"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ef66b6ce",
   "metadata": {},
   "source": [
    "* 如何在自己的电脑上打开jupyter notebook？  <br>—在cmd中直接执行jupyter notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b9a8db13",
   "metadata": {},
   "source": [
    "* jupyter notebook 可以做代码的系统管理"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9d38625f",
   "metadata": {},
   "source": [
    "* localhost 为本地路径，在学习jupyter notebook时又学习到了如何对文件夹进行整理"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b114464a",
   "metadata": {},
   "source": [
    "### 4.变量、赋值、数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0580e165",
   "metadata": {},
   "source": [
    "* 变量是存放信息的容器，且不能为空需声明变量"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e061ba75",
   "metadata": {},
   "source": [
    "* 变量名只能是 字母、数字或下划线的任意组合"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfd3310a",
   "metadata": {},
   "source": [
    "* 变量名的第一个字符不能是数字"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04d8fbfa",
   "metadata": {},
   "source": [
    "* 以下关键字不能声明为变量名\n",
    " <br>['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda','not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "55623f5c",
   "metadata": {},
   "source": [
    "#### 声明变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "f90e0ac3",
   "metadata": {},
   "outputs": [],
   "source": [
    " name =\"Haixin Luo\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "21b8c663",
   "metadata": {},
   "outputs": [],
   "source": [
    "Karry_猫=\"cute\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c3a22ae",
   "metadata": {},
   "source": [
    "#### 案例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "9f153dd5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Karry Karry\n",
      "What is the value of name2 now? Karry\n"
     ]
    }
   ],
   "source": [
    "name = \"Karry\"\n",
    "\n",
    "name2 = name\n",
    "print(name,name2)\n",
    "\n",
    "name = \"Jackson\"\n",
    "\n",
    "print(\"What is the value of name2 now?\",name2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7e35e173",
   "metadata": {},
   "source": [
    "* 为什么使用英文而不是中文？ <br>英文命名比较合理，中文比较占字符，运行速度相对较慢"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f733ca5",
   "metadata": {},
   "source": [
    "* 变量一旦创建就为一个独立的个体"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e78ee4b",
   "metadata": {},
   "source": [
    "* 代码运行是从上到下的，除了循环函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e05a5305",
   "metadata": {},
   "source": [
    "### 赋值"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ae7d0c11",
   "metadata": {},
   "source": [
    "* 赋值为="
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f3181a9",
   "metadata": {},
   "source": [
    "### 数字number"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8bcdf637",
   "metadata": {},
   "source": [
    "* 整数 int <br>浮点 float 有小数点的数字"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf7899a8",
   "metadata": {},
   "source": [
    "### 字符串striking"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb7f7ea3",
   "metadata": {},
   "source": [
    "*  '...' \"...\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1caa4d06",
   "metadata": {},
   "source": [
    "* \\ 转义符 相同的符号有多余两个的需用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6431893c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"doesn't\""
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'doesn\\'t'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eae2b480",
   "metadata": {},
   "source": [
    "### 6.if/else"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b273c6c2",
   "metadata": {},
   "source": [
    "### 7.课本代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "8cc7de4b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "354fcfe8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2021, tm_mon=9, tm_mday=12, tm_hour=16, tm_min=12, tm_sec=38, tm_wday=6, tm_yday=255, tm_isdst=0)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7810f4fd",
   "metadata": {},
   "source": [
    "* 0代表1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "15e796c2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [ 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59 ]\n",
    "      \n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "040c7dd2",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds =[ 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59 ]\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute.\")\n",
    "    wait_time = random.randint(1,60)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "25f3f15c",
   "metadata": {},
   "outputs": [],
   "source": [
    "word = \"bottles\"\n",
    " \n",
    "for beer_num in range(99, 0, -1):\n",
    " \n",
    "     print(beer_num, word,\"of beer on the wal1.\")\n",
    "     print(beer_num, word,\"of beer.\")\n",
    "    print(\"Take one down.\") \n",
    "     print(\"Pass it around.\")\n",
    " \n",
    "    if beer_num == 1:\n",
    " \n",
    "      print(\"No more bottles of beer on the wal1.\")\n",
    " \n",
    "    else:\n",
    "        new_num = beer_num - 1   \n",
    "    if new_num == 1:\n",
    "        word=\"bottle\"\n",
    "    print (new_num,word,\"of beer on the wal1.\") \n",
    "    print()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16ade455",
   "metadata": {},
   "source": [
    "* 如何快速查看一个标准库模块的办法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a731ba57",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "88bb6a87",
   "metadata": {},
   "outputs": [],
   "source": [
    "?? time.gmtime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8c1c94ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "time.time()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
